.pg-form-item .pg-checkbox,
.pg-form-item .pg-radio {

  height: $form-item-height-base;
  &.border {
    padding: 0 7px;
  }

  &.sm {
    height: $form-item-height-sm;
    &.border {
      padding: 0 4px;
    }
  }

  &.lg {
    height: $form-item-height-lg;
    &.border {
      padding: 0 10px;
    }
  }

}


.pg-checkbox, .pg-radio {
  display: flex;
  align-items: center;

  & > .toggle {
    cursor: pointer;
    background-color: $white;
    transition: border-color .3s ease, background-color .3s ease;
  }

  & > label {

    vertical-align: middle;
    cursor: pointer;
    padding: 0 5px 0 10px;
    margin-bottom: 0;
    user-select: none;
  }

  &.checked {
    & > .toggle {
      background-color: $primary;
      border-color: $primary;
      position: relative;
    }
  }

  &.checked.disabled {
    cursor: not-allowed;

    & > .toggle {
      border-color: $primary;
      background-color: $primary;
      cursor: not-allowed;
      opacity: 0.7;
    }

    & > label {
      cursor: not-allowed;
    }
  }

  &.disabled {
    cursor: not-allowed;

    & > .toggle {
      border-color: $light;
      background-color: $light;
      cursor: not-allowed;
    }

    & > label {
      cursor: not-allowed;
    }
  }

  &.disabled:active {
    pointer-events: none;
  }
}

.pg-checkbox > .icon-indeterminate {
  color: $primary !important;
}

.pg-checkbox > .toggle {
  padding: 7px;
  border: $border-width solid $border-color;
}

.pg-checkbox.checked > .toggle:before {
  left: -1px;
  top: -5px;
  content: '\e372';
  font-family: "icomoon", serif !important;
  font-style: normal;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #FFF;
  position: absolute;
}

.pg-radio > .toggle {
  border-radius: $rounded-round;
  padding: 7px;
  border: $border-width solid $border-color;
}

.pg-radio.checked > .toggle:before {
  left: 3px;
  top: -5px;
  content: '\f052';
  font-family: "icomoon", serif !important;
  font-style: normal;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #FFF;
  position: absolute;
}

.pg-checkbox + .pg-checkbox {
  margin-top: 8px;
}
.pg-radio + .pg-radio {
  margin-top: 8px;
}

ul.pg-checkbox,
ul.pg-checkbox-group,
ul.pg-radio,
ul.pg-radio-group {
  list-style: none;
  padding-left: 0;
  margin-bottom: 0;
}

.pg-checkbox-group.inline,
.pg-radio-group.inline {
  display: flex;
  .pg-checkbox + .pg-checkbox {
    margin-left: 20px;
    margin-top: 0;
  }
  .pg-radio + .pg-radio {
    margin-left: 20px;
    margin-top: 0;
  }
}

// border 样式 只在 radio-group 且 inline 模式下有效，组件内部会做判断

.pg-radio.border {
  cursor: pointer;
  border: $border-width solid $border-color;
  transition: border-color .2s ease, background-color .2s ease;

  &:hover {
    background-color: darken($white, 2%);
  }

  & > .toggle {
    border-color: $border-color;
  }

  &.checked {
    border-color: $primary;
    & > .toggle {
      border-color: $primary;
    }
  }

  &.disabled {
    border-color: $border-color;
  }

}

.pg-radio-group.inline {
  .pg-radio.border + .pg-radio.border {
    margin-left: 30px;
  }
}